import { Module, OnModuleInit } from '@nestjs/common';
import { FileStorageService } from './file-storage.service';
import { FileStorageController } from './file-storage.controller';
import { TypeOrmModule } from '@nestjs/typeorm';
import { FileStorage } from './entities/file-storage.entity';
import { MulterModule } from '@nestjs/platform-express';
import path from 'path';
import fs from 'fs-extra';

import { multerOptions } from "@/config/multer.config"


@Module({
  imports: [
    TypeOrmModule.forFeature([FileStorage]),
    MulterModule.registerAsync({
      useFactory: () => multerOptions(['text/plain', 'application/json']),
    })
  ],
  controllers: [FileStorageController],
  providers: [FileStorageService],
  exports: [FileStorageService],
})
export class FileStorageModule { }